import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'


export default defineConfig({
    plugins: [react()],
    resolve: {
        alias: {
            '@': new URL('./src', import.meta.url).pathname,
        },
    },
    server: {
        host: '0.0.0.0',
        port: 7878,
        open: true,
        // proxy: {
        //     '/api': {
        //         target: 'http://192.168.11.104:9999',
        //         changeOrigin: true,
        //         secure: false,
        //         configure: (proxy, options) => {
        //             proxy.on('error', (err, req, res) => {
        //                 console.log('proxy error', err);
        //             });
        //             proxy.on('proxyReq', (proxyReq, req, res) => {
        //                 console.log('Sending Request to the Target:', req.method, req.url);
        //             });
        //             proxy.on('proxyRes', (proxyRes, req, res) => {
        //                 console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
        //             });
        //         },
        //     },
        // },
    },
    build: {
        outDir: 'dist',
        sourcemap: false,
        rollupOptions: {
            output: {
                manualChunks: {
                    vendor: ['react', 'react-dom'],
                    antd: ['antd'],
                    router: ['react-router-dom'],
                },
            },
        },
    },
}) 